%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/js-reserved-function-names"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 11, 12, 45, 46, 47, 48, 49, 50, 51, 13, 14, 22, 31, 42<br />2: 10, 20, 29, 36<br />3: 16, 24, 33, 39<br />ᐳ: 15, 17, 18, 23, 25, 26, 32, 34, 35, 38, 40"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 40<br /><br />ROOT PgSelectSingleᐸnullᐳ[40]"):::bucket
    end
    Bucket0 --> Bucket1

    %% plan dependencies
    PgFromExpression14{{"PgFromExpression[14∈0] ➊<br />More deps:<br />- Constantᐸ4ᐳ[45]<br />- Constantᐸ1ᐳ[46]<br />- Constantᐸ2ᐳ[47]<br />- Constantᐸ3ᐳ[48]"}}:::plan
    PgFromExpression31{{"PgFromExpression[31∈0] ➊<br />More deps:<br />- Constantᐸ8ᐳ[50]<br />- Constantᐸ2ᐳ[47]<br />- Constantᐸ4ᐳ[45]<br />- Constantᐸ6ᐳ[51]"}}:::plan
    PgFromExpression42{{"PgFromExpression[42∈0] ➊<br />More deps:<br />- Constantᐸ4ᐳ[45]<br />- Constantᐸ1ᐳ[46]<br />- Constantᐸ2ᐳ[47]<br />- Constantᐸ3ᐳ[48]"}}:::plan
    PgSelect36[["PgSelect[36∈0] ➊<br />ᐸnullᐳ<br />More deps:<br />- Constantᐸ1ᐳ[46]"]]:::plan
    Object13{{"Object[13∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Object13 & PgFromExpression42 --> PgSelect36
    PgSelect10[["PgSelect[10∈0] ➊<br />ᐸawaitᐳ"]]:::plan
    Object13 & PgFromExpression14 --> PgSelect10
    Access11{{"Access[11∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access12{{"Access[12∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access11 & Access12 --> Object13
    PgSelect20[["PgSelect[20∈0] ➊<br />ᐸcaseᐳ"]]:::plan
    PgFromExpression22{{"PgFromExpression[22∈0] ➊<br />More deps:<br />- Constantᐸ10ᐳ[49]"}}:::plan
    Object13 & PgFromExpression22 --> PgSelect20
    PgSelect29[["PgSelect[29∈0] ➊<br />ᐸvalueOfᐳ"]]:::plan
    Object13 & PgFromExpression31 --> PgSelect29
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access11
    __Value2 --> Access12
    First15{{"First[15∈0] ➊"}}:::plan
    PgSelectRows16[["PgSelectRows[16∈0] ➊"]]:::plan
    PgSelectRows16 --> First15
    PgSelect10 --> PgSelectRows16
    PgSelectSingle17{{"PgSelectSingle[17∈0] ➊<br />ᐸawaitᐳ"}}:::plan
    First15 --> PgSelectSingle17
    First23{{"First[23∈0] ➊"}}:::plan
    PgSelectRows24[["PgSelectRows[24∈0] ➊"]]:::plan
    PgSelectRows24 --> First23
    PgSelect20 --> PgSelectRows24
    PgSelectSingle25{{"PgSelectSingle[25∈0] ➊<br />ᐸcaseᐳ"}}:::plan
    First23 --> PgSelectSingle25
    First32{{"First[32∈0] ➊"}}:::plan
    PgSelectRows33[["PgSelectRows[33∈0] ➊"]]:::plan
    PgSelectRows33 --> First32
    PgSelect29 --> PgSelectRows33
    PgSelectSingle34{{"PgSelectSingle[34∈0] ➊<br />ᐸvalueOfᐳ"}}:::plan
    First32 --> PgSelectSingle34
    First38{{"First[38∈0] ➊"}}:::plan
    PgSelectRows39[["PgSelectRows[39∈0] ➊"]]:::plan
    PgSelectRows39 --> First38
    PgSelect36 --> PgSelectRows39
    PgSelectSingle40{{"PgSelectSingle[40∈0] ➊<br />ᐸnullᐳ"}}:::plan
    First38 --> PgSelectSingle40
    PgClassExpression43{{"PgClassExpression[43∈1] ➊<br />ᐸ(1/0) /* E...ferred! */ᐳ"}}:::plan
    PgSelectSingle40 --> PgClassExpression43
    PgClassExpression44{{"PgClassExpression[44∈1] ➊<br />ᐸ__null__.”break”ᐳ"}}:::plan
    PgClassExpression43 o--o PgClassExpression44

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect10,Access11,Access12,Object13,PgFromExpression14,First15,PgSelectRows16,PgSelectSingle17,PgSelect20,PgFromExpression22,First23,PgSelectRows24,PgSelectSingle25,PgSelect29,PgFromExpression31,First32,PgSelectRows33,PgSelectSingle34,PgSelect36,First38,PgSelectRows39,PgSelectSingle40,PgFromExpression42 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PgClassExpression43,PgClassExpression44 bucket1

